import Vue from 'vue'
import Vuex from 'vuex'
import goods from './modules/goods'
import actions from './actions'
import mutations from './mutations'
import getters from './getters'
import { getCookie } from '_commonFn/cookie'
import { isWechatBroser, isIosBrowser, isAndroid } from "_commonFn/browser"

Vue.use(Vuex)

export default new Vuex.Store({
	state: {
		user: {
			token: getCookie('Token'),
			ticket: getCookie('Ticket'),
			userId: getCookie('UserId'),
			safetyfactor: getCookie('Safetyfactor'),
			userName: decodeURI(getCookie('UserName')),
			userRegDate: getCookie('UserRegDate'),
			userHeadImg: getCookie('UserHeadImg'),
		},
		wechat: {
			isWechatBro: isWechatBroser(),
			getGetWechatSdkStu: 'ing',
		},
		success: {
			page: '',
			type: '',
			data: {}
		},
		browser: {
			isIos: isIosBrowser(),
			isAndroid: isAndroid(),
		},
		productList: [],
		showUpDataTime: 0,
	},
	mutations,
	actions,
	modules: {
		goods
	},
	getters,
})
